﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>定时任务 </title>
    <link href="../static/css/admin.css?v=6" rel="stylesheet" />
    <script src="../static/js/boot.js?v=2"></script>
    <script src="../static/js/admin.js?v=2"></script>
    <script>
        var apiUrl = API_PATH + "/OpenJob/";
        var keyValue = $.request("keyValue");
        var IsEdit = $.request("IsEdit");
        var selectValue = 0;
        var kty = 1;
        $(function () {
            initControl();
            console.log(keyValue);
            if (!!keyValue) {
                $.ajax({
                    url: apiUrl + "GetFormJson?keyId=" + keyValue,
                    data: { keyValue: keyValue },
                    dataType: "json",
                    async: false,
                    beforeSend: function (jqXHR) {
                        jqXHR.setRequestHeader("Authorization", 'Bearer ' + window.LS.get("lmgcmstoken"));
                    },
                    success: function (ret) {
                        $("#form1").formSerialize(ret.data);
                    }
                });
            }
            if (IsEdit == "0") {
                //查看
                $("#btn_finish").attr("disabled", "disabled");
            }
        })
        function initControl() {

            laydate.render({
                elem: '#NextRunTime',
                format: 'yyyy-MM-dd',
                trigger: 'click'
            });

            laydate.render({
                elem: '#LastRunTime',
                format: 'yyyy-MM-dd',
                trigger: 'click'
            });

            laydate.render({
                elem: '#LastErrorTime',
                format: 'yyyy-MM-dd',
                trigger: 'click'
            });

            laydate.render({
                elem: '#CreateTime',
                format: 'yyyy-MM-dd',
                trigger: 'click'
            });

            laydate.render({
                elem: '#UpdateTime',
                format: 'yyyy-MM-dd',
                trigger: 'click'
            });
        }

        function submitForm() {
            if (!$('#form1').formValid()) {
                return false;
            }
            var aurl = apiUrl + "Add";
            if (!!keyValue) {
                aurl = apiUrl + "Update";
            }
            var paramform = $("#form1").formSerialize();
            //paramform["CurrentType"] = $("input[name='rDate']:checked").val();

            $.submitForm({
                url: aurl,
                param: paramform,
                paramType: true,
                success: function () {
                    $.currentWindow().$("#gridList").resetSelection();
                    $.currentWindow().$("#gridList").trigger("reloadGrid");
                }
            })
        }
    </script>
</head>
<body style="margin:0px;padding:0px;overflow:hidden;">
    <form id="form1">
        <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
            <div style="padding-top: 20px; margin-right: 30px;">
                <input type="hidden" id="Id" name="Id" value="" />
                <table class="form">
                    <tr>
                        <th class="formTitle">任务名称<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="JobName" name="JobName" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">任务执行次数<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="RunCount" name="RunCount" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">异常次数<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="ErrorCount" name="ErrorCount" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">下次执行时间<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="NextRunTime" name="NextRunTime" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">最后一次执行时间<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="LastRunTime" name="LastRunTime" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">最后一次失败时间<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="LastErrorTime" name="LastErrorTime" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">任务执行方式0：本地任务；1：外部接口任务<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="JobType" name="JobType" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">任务地址<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="JobCall" name="JobCall" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">任务参数，JSON格式<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="JobCallParams" name="JobCallParams" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">CRON表达式<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="Cron" name="Cron" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">任务运行状态（0：停止，1：正在运行，2：暂停）<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="Status" name="Status" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">备注<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="Remark" name="Remark" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">创建时间<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="CreateTime" name="CreateTime" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">创建人ID<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="CreateUserId" name="CreateUserId" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">创建人<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="CreateUserName" name="CreateUserName" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">最后更新时间<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="UpdateTime" name="UpdateTime" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">最后更新人ID<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="UpdateUserId" name="UpdateUserId" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">最后更新人<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="UpdateUserName" name="UpdateUserName" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">所属部门<span style="color:#ff0000">*</span></th>
                        <td class="formValue">
                            <input id="OrgId" name="OrgId" type="text" class="form-control required" autocomplete="off" maxlength="200" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body>
</html>